package com.ruoyi.system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ruoyi.system.mapper.DbIdentityManagementMapper;
import com.ruoyi.system.mapper.DbPhysicalManagementMapper;
import com.ruoyi.system.mapper.DbQualificationManagementMapper;
import com.ruoyi.system.mapper.ExamManagementMapper;
import com.ruoyi.system.mapper.IdentityManagementMapper;
import com.ruoyi.system.mapper.PhysicalManagementMapper;
import com.ruoyi.system.mapper.QualificationManagementMapper;
import com.ruoyi.system.mapper.ResultManagementMapper;
import com.ruoyi.system.mapper.ScoreManagementMapper;
import com.ruoyi.system.service.ISystemInitService;

/**
 * 系统初始化Service业务层处理
 * 
 * @author ruoyi
 */
@Service
public class SystemInitServiceImpl implements ISystemInitService 
{
    @Autowired
    private ExamManagementMapper examManagementMapper;
    
    @Autowired
    private ScoreManagementMapper scoreManagementMapper;
    
    @Autowired
    private QualificationManagementMapper qualificationManagementMapper;
    
    @Autowired
    private IdentityManagementMapper identityManagementMapper;
    
    @Autowired
    private PhysicalManagementMapper physicalManagementMapper;
    
    @Autowired
    private DbQualificationManagementMapper dbQualificationManagementMapper;
    
    @Autowired
    private DbIdentityManagementMapper dbIdentityManagementMapper;
    
    @Autowired
    private DbPhysicalManagementMapper dbPhysicalManagementMapper;
    
    @Autowired
    private ResultManagementMapper resultManagementMapper;

    /**
     * 清空所有业务表数据
     * 
     * @return 结果
     */
    @Override
    @Transactional
    public int cleanAllData()
    {

        // 终审结果表
        resultManagementMapper.deleteAllResultManagement();

        // 递补体能测试表
        dbPhysicalManagementMapper.deleteAllDbPhysicalManagement();

        // 递补身份验证表
        dbIdentityManagementMapper.deleteAllIdentityManagement();

        // 递补资格审查表
        dbQualificationManagementMapper.deleteAllDbQualificationManagement();

        // 体能测评表
        physicalManagementMapper.deleteAllPhysicalManagement();

        // 身份验证表
        identityManagementMapper.deleteAllIdentityManagement();

        // 资格审查表
        qualificationManagementMapper.deleteAllQualificationManagement();

        // 成绩合格名单表
        scoreManagementMapper.deleteAllScoreManagement();

        // 成绩录入表
        examManagementMapper.deleteAllExamManagement();

        return 1;
    }
} 